Skip to content

Fix/285 consistent reports across databases - #302

Merged
Martin-1997 merged 4 commits into
masterfrom
fix/285-consistent-reports-across-databases
Nov 10, 2026
Merged

Martin-1997 merged 4 commits into
masterfrom
fix/285-consistent-reports-across-databases

Conversation

@Martin-1997

Copy link
Copy Markdown
Collaborator

Implements #285

Martin-1997 and others added 3 commits November 10, 2026 17:42
New workflow integration.yml: for Nextcloud stable31 and stable35, each on
SQLite, MySQL 8.4, MariaDB 11.4 and PostgreSQL 16, it checks out the server,
puts the app into apps/timetracker, installs Nextcloud on that database and
runs phpunit.integration.xml with the server's own PHPUnit version.
MySQL and MariaDB run with ONLY_FULL_GROUP_BY, like Nextcloud's own CI.

The integration bootstrap used OC::$loader, which no longer exists; it now
loads Test\TestCase through the server's tests/autoload.php.

Refs #285

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015KJpM1wJdw3Uxw5p86uRBD
Reports grouped by day, week, month or year differed between SQLite,
MySQL/MariaDB and PostgreSQL: each database built the time groups with its
own date functions, in UTC, and weeks were not ISO weeks around New Year.

The report now reads the matching entries with one portable query and
groups them in PHP:
- time groups follow the user's Nextcloud time zone (fallback: the server's
  default time zone, then UTC), including daylight saving time
- weeks are ISO 8601 weeks, labelled like 2025-W01 (30 Dec 2024 belongs to
  2025-W01)
- name, project, client and user lists of a group contain distinct values in
  order of appearance; name lists are shortened to 40 characters + '...'
- rows are ordered by their first entry

The time zone comes from a new UserTimeZone service. OCP\IDateTimeZone
can't be used: during a web request it may be created before login and
then always returns the server's default.

Integration tests cover time groups (midnight, DST, ISO year boundary),
grouping by project/client/user, filters and paging.

Fixes #285

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015KJpM1wJdw3Uxw5p86uRBD
…eriods

getStartOfWeek() combined the ISO week number with the calendar year, so
30 Dec 2024 (week 1 of 2025) was treated as week 1 of 2024, a year too early.
Week and month starts were also computed in UTC instead of the user's time
zone. Both now match the report grouping.

Refs #285

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015KJpM1wJdw3Uxw5p86uRBD
@Martin-1997 Martin-1997 self-assigned this Nov 10, 2026
With a database user that may create roles, like the root user of the
postgres image, Nextcloud's installer connects to the target database
before creating it, and fails with 'database "nextcloud" does not exist'.
Nextcloud's own CI pre-creates it the same way.

Refs #285

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015KJpM1wJdw3Uxw5p86uRBD
@Martin-1997
Martin-1997 merged commit 2ebfa3c into master Nov 10, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant